import { lazy } from "react";
// 引入需要的icon
import { MenuOutlined } from "@ant-design/icons";
// propertyManagement 子路由
export const propertyManagementChildren = [
  // 团购管理页 三级路由
  {
    meta: "楼盘管理",
    icon: <MenuOutlined />,
    path: "/home/propertiesforsale/propertymanagement",
    element: lazy(() =>
      import(
        "../pages/home/propertiesforsale/propertymanagement/PropertyManagement"
      )
    ),
    children: [
      // 楼盘列表 页面 四级路由
      {
        meta: "楼盘列表",
        path: "/home/propertiesforsale/propertymanagement/propertylist",
        element: lazy(() =>
          import(
            "../pages/home/propertiesforsale/propertymanagement/propertylist/PropertyList"
          )
        ),
      },
      // 楼盘添加 页面 四级路由
      {
        meta: "楼盘添加",
        role: "admin",
        path: "/home/propertiesforsale/propertymanagement/addaproperty",
        element: lazy(() =>
          import(
            "../pages/home/propertiesforsale/propertymanagement/addaproperty/AddAProperty"
          )
        ),
      },
    ],
  },
  // 开发商页 三级路由
  {
    meta: "开发商页",
    icon: <MenuOutlined />,
    path: "/home/propertiesforsale/developer",
    element: lazy(() =>
      import("../pages/home/propertiesforsale/developer/Developer")
    ),
    children: [
      // 开发商列表 页 四级路由
      {
        meta: "开发商列表",
        path: "/home/propertiesforsale/developer/developerlist",
        element: lazy(() =>
          import(
            "../pages/home/propertiesforsale/developer/Developerlist/DeveloperList"
          )
        ),
      },
    ],
  },
  // 团购管理 页 三级路由
  {
    meta: "团购管理",
    icon: <MenuOutlined />,
    path: "/home/propertiesforsale/groupbuyingmanagement",
    element: lazy(() =>
      import(
        "../pages/home/propertiesforsale/groupbuyingmanagement/GroupBuyingManagement"
      )
    ),
    children: [
      // 楼盘列表 页面 四级路由
      {
        meta: "添加团购",
        role: "admin",
        path: "/home/propertiesforsale/groupbuyingmanagement/addgroupbuying",
        element: lazy(() =>
          import(
            "../pages/home/propertiesforsale/groupbuyingmanagement/addgroupbuying/AddBroupBuying"
          )
        ),
      },
      // 团购列表 页 四级路由
      {
        meta: "团购列表",
        path: "/home/propertiesforsale/groupbuyingmanagement/grouppurchaselist",
        element: lazy(() =>
          import(
            "../pages/home/propertiesforsale/groupbuyingmanagement/grouppurchaselist/GroupPurchaseList"
          )
        ),
      },
    ],
  },
];
//  customerserviceChildren 客服子路由
export const customerserviceChildren = [
  // 客服列表 三级路由
  {
    meta: "客服列表",
    icon: <MenuOutlined />,
    path: "/home/customerservice/customerserviceList",
    element: lazy(() =>
      import(
        "../pages/home/customerservice/CustomerServiceList/CustomerServiceList"
      )
    ),
  },
  // 客服信息总览 三级路由
  {
    meta: "客服信息总览",
    icon: <MenuOutlined />,
    role: "admin",
    path: "/home/customerservice/overviewofcustomerserviceinformation",
    element: lazy(() =>
      import(
        "../pages/home/customerservice/OverviewOfCustomerServiceInformation/OverviewOfCustomerServiceInformation"
      )
    ),
  },
  // 会话管理 三级路由
  {
    meta: "会话管理",
    icon: <MenuOutlined />,
    path: "/home/customerservice/sessionmanagement",
    element: lazy(() =>
      import(
        "../pages/home/customerservice/SessionManagement/SessionManagement"
      )
    ),
    children: [
      // 游客列表 四级路由
      {
        meta: "游客列表",
        role: "admin",
        path: "/home/customerservice/sessionmanagement/touristlist",
        element: lazy(() =>
          import(
            "../pages/home/customerservice/SessionManagement/TouristList/TouristList"
          )
        ),
      },
      // 服务记录 四级路由
      {
        meta: "服务记录",
        path: "/home/customerservice/sessionmanagement/servicerecord",
        element: lazy(() =>
          import(
            "../pages/home/customerservice/SessionManagement/ServiceRecord/ServiceRecord"
          )
        ),
      },
      // 聊天记录 四级路由
      {
        meta: "聊天记录",
        path: "/home/customerservice/sessionmanagement/chatrecords",
        element: lazy(() =>
          import(
            "../pages/home/customerservice/SessionManagement/ChatRecords/ChatRecords"
          )
        ),
      },
    ],
  },
];
// 二手出租路由表
export const usedrentedChildren = [
  {
    // 小区管理
    meta: '小区管理',
    icon: <MenuOutlined />,
    path: '/home/usedrented/communitymanagement',
    element: lazy(() => import('../pages/home/usedrented/communitymanagement/CommunityManagement')),
    children: [
      {
        // 小区管理
        meta: '小区管理.',
        path: '/home/usedrented/communitymanagement/communitymanagements',
        element: lazy(() => import('../pages/home/usedrented/communitymanagement/communitymanagements/CommunityManagements')),
      }
    ]
  },
  {
    // 二手房
    meta: '二手房',
    icon: <MenuOutlined />,
    path: '/home/usedrented/secondhandhouse',
    element: lazy(() => import('../pages/home/usedrented/secondhandhouse/SecondHandHouse')),
    children: [
      {
        // 房源管理
        meta: '房源管理',
        path: '/home/usedrented/secondhandhouse/propertymanagement',
        element: lazy(() => import('../pages/home/usedrented/secondhandhouse/propertymanagement/PropertyManagement')),
      },
      {
        // 添加房源
        meta: '添加房源',
        path: '/home/usedrented/secondhandhouse/addlistings',
        element: lazy(() => import('../pages/home/usedrented/secondhandhouse/addlistings/AddListings')),
      }
    ]
  },
  {
    // 出租房
    meta: '出租房',
    icon: <MenuOutlined />,
    path: '/home/usedrented/rentalhousing',
    element: lazy(() => import('../pages/home/usedrented/rentalhousing/RentalHousing')),
    children: [
      {
        // 房源管理
        meta: '房源管理.',
        path: '/home/usedrented/rentalhousing/propertymanagement',
        element: lazy(() => import('../pages/home/usedrented/rentalhousing/propertymanagement/PropertyManagement')),
      },
      {
        // 添加房源
        meta: '添加房源.',
        path: '/home/usedrented/rentalhousing/addlistings',
        element: lazy(() => import('../pages/home/usedrented/rentalhousing/addlistings/AddListings')),
      }
    ]
  }
]
// 路由表
const routers = [
  {
    path: "/",
    to: "/home/propertiesforsale/propertymanagement",
  },
  // 一级路由
  {
    path: "/home",
    element: lazy(() => import("../pages/Home")),
    children: [
      // 楼盘二级
      {
        path: "/home/propertiesforsale",
        element: lazy(() =>
          import("../pages/home/propertiesforsale/PropertiesForSale")
        ),
        children: propertyManagementChildren,
      },
      // 客服二级
      {
        path: "/home/customerservice",
        element: lazy(() =>
          import("../pages/home/customerservice/CustomerService")
        ),
        children: customerserviceChildren,
      },
      //  控制面板 二级
      {
        path: "/home/controlpanel",
        element: lazy(() => import("../pages/home/controlpanel/ControlPanel")),
      },
      {
        // 二手/出租
        path: "/home/usedrented",
        element: lazy(() => import('../pages/home/usedrented/UsedRented')),
        children: usedrentedChildren
      },
    ],
  },

  // 登录页
  {
    path: "/login",
    element: lazy(() => import("../pages/Login")),
  },
  // 错误页面
  {
    path: "*",
    element: lazy(() => import("../pages/Error")),
  },
  // 地图标注页
  {
    path: "/map",
    element: lazy(() => import("../pages/home/propertiesforsale/propertymanagement/addaproperty/Map")),
  },
];

export default routers;
